﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HaumDisplay
{
    public class HaumPoint : HaumShape
    {
        /// <summary>
        /// 点坐标
        /// </summary>
        public PointF center;

        /// <summary>
        /// 画笔
        /// </summary>
        internal Pen pen;

        /// <summary>
        /// 反色
        /// </summary>
        internal Color invertColor;

        /// <summary>
        /// 是否选中
        /// </summary>
        internal bool isSelect;

        /// <summary>
        /// 开始绘制
        /// </summary>
        internal bool startGraphic;

        public HaumPoint(Color color, int borderSize = 1)
        {
            this.center = new PointF(0, 0);
            this.pen = new Pen(color, borderSize);
            //this.invertColor = Color.FromArgb(255 - color.R, 255 - color.G, 255 - color.B);
            this.invertColor = Color.FromArgb(color.R / 2, color.G / 2, color.B / 2);
            this.isSelect = false;
            this.startGraphic = false;
        }

        public override string ToString() {
            return $"点中心坐标:[{center.X},{center.Y}]";
        }

        public override void Graphic(Graphics g, GraphicHelper myGraphic)
        {
            g.SmoothingMode = SmoothingMode.HighQuality;
            PointF center = Tools.ImageTransScreenPointF(this.center, myGraphic.scale, myGraphic.offset);
            //float length = 5 * myGraphic.scale;
            float length = 10;
            // 绘制垂直的线（中心点上下各 5 像素）
            g.DrawLine(this.pen, center.X, center.Y - length, center.X, center.Y + length);
            // 绘制水平的线（中心点左右各 5 像素）
            g.DrawLine(this.pen, center.X - length, center.Y, center.X + length, center.Y);
        }
    }
}
